home *** CD-ROM | disk | FTP | other *** search
/ WWII Attack! from Pearl Harbor to Potsdam / WWII Attack - From Pearl Harbor to Potsdam - Disc 3.iso / pc / us / register / 00069_Script_motion behavior < prev    next >
Text File  |  2001-05-01  |  4KB  |  86 lines

  1. --*** Motion Button score behavior script ***
  2. --        Revised 12/7/97
  3.  
  4. property downMemberNumOffset
  5. property offsetH
  6. property offsetV
  7. property downSnd
  8. property upSnd
  9. property Action
  10. property WhichLabel
  11.  
  12. on mouseDown
  13.   --  motion 1, 2, 2, "Hit button4", 0
  14.   Motion downMemberNumOffset, offsetH, offsetV, downSnd, upSnd
  15.   -- 'mouseup' action
  16.   if rollOver(clickOn()) then -- Apple Legal stuff
  17.     if Action = "Go to marker" then go to WhichLabel
  18.     else if Action = "Play marker" then play WhichLabel
  19.   end if
  20. end
  21.  
  22. on getPropertyDescriptionList
  23.         global ibcDefaultParams
  24.   if listp(ibcDefaultParams) then
  25.     return ibcDefaultParams
  26.   else
  27.         set description = [:]
  28.     addProp description,#downMemberNumOffset,[#comment:"Clicked Member Offset:", #format:#integer, #default: 1]
  29.     addProp description,#offsetH,[#comment:"Horizontal motion:", #format:#integer, #default: 2]
  30.     addProp description,#offsetV,[#comment:"Vertical motion:", #format:#integer, #default: 2]
  31.     addProp description,#DownSnd,[#default:"Silence",#format:#sound,#comment:"Down Sound Member:"]
  32.         addProp description,#UpSnd,[#default:"Silence",#format:#sound,#comment:"Up Sound Member:"]
  33.     addProp description,#Action,[#default: #"None",#range: [ #"None", #"Go to marker", #"Play marker" ], #format:#symbol,#comment:"MouseUp Action:"]
  34.     addProp description, #WhichLabel, [ #comment: "Destination Marker:",  #format: #marker, #default:  "next" ]
  35.     return description
  36.   end if
  37. end
  38.  
  39. on btnSound asoundName -- does a little validation
  40.   if stringp(asoundName) and asoundName <> "Silence" then
  41.     puppetSound asoundName
  42.   end if
  43. end
  44.  
  45. on  getBehaviorDescription
  46.   return "- Motion Behavior -"¨
  47. & return & "Defined: controls a single or dual-image button that moves horizontally and/or vertically on mouseDown."¨
  48. & return & "Intended Use: to give user a strong audio + visual feedback that they've engaged a control. Rolling off button during mouseDown will disengage."¨
  49. & return & return & "- Properties -"¨
  50. & return & "MouseDown Image: assigns the castmember used for the mouseDown state. 0 represents the first image, 1 the second, 2 the third, and so on."¨
  51. & return & "Horizontal Motion: assigns the number of pixels the button moves horizontally (negative numbers move left)."¨
  52. & return & "Vertical Motion: assigns the number of pixels the button moves vertically (negative numbers move up)."¨
  53. & return & "Down Sound: assigns a mouseDown button sound."¨
  54. & return & "Up Sound: assigns a mouseUp button sound."¨
  55. & return & "MouseUp Action: assigns a button course of action."¨
  56. & return & "  (Note: Select 'None' if you plan to add a seperate mouseUp behavior to this button)"¨
  57. & return & "Destination Marker: assigns a destination to the course of action."¨
  58. & return & return & "(Explore the 'LookHere' folder on the CD-Rom for examples of each behavior)"
  59. end
  60.  
  61. ---  the handler code ---
  62.  
  63. on motion new, offsetH, offsetV, downSound, upSound
  64.   set emem = the membernum of sprite clickon()
  65.   set horz = the locH of sprite clickon()
  66.   set vert = the locV of sprite clickon()
  67.   if stringP(downSound) then btnSound downSound
  68.   updatestage
  69.   set the membernum of sprite clickon() = (emem + new)
  70.   set the loch of sprite clickon() = (horz + offsetH)
  71.   set the locv of sprite clickon() = (vert + offsetV)
  72.   updatestage
  73.   repeat while the stillDown or soundBusy (1)
  74.   end repeat
  75.   if stringP(upSound) and rollOver(clickOn()) then btnSound upSound -- Apple Legal
  76.   updatestage
  77.   set the membernum of sprite clickon() = emem
  78.   set the loch of sprite clickon() = horz
  79.   set the locv of sprite clickon() = vert
  80.   updatestage
  81.   repeat while soundBusy (1)
  82.   end repeat
  83.   puppetSound 0
  84.   updateStage
  85. end 
  86.